Imports System
Imports System.Text
Imports System.Configuration
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.ComponentModel
Imports Microsoft.Practices.EnterpriseLibrary.Configuration.Design
Imports Microsoft.Practices.EnterpriseLibrary.Configuration.Design.Validation

''' <summary>
''' Represents the design manager for the $Caption$ settings configuration section.
''' </summary>
Public NotInheritable Class ConfigurationDesignManager
	Inherits Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ConfigurationDesignManager
	''' <summary>
	''' Register the commands and node maps needed for the design manager into the design time.
	''' </summary>
	''' <param name="serviceProvider">The a mechanism for retrieving a service object that is, an object that provides custom support to other objects.</param>
	Public Overrides Sub Register(ByVal serviceProvider As IServiceProvider)
		Dim cmdRegistrar As CommandRegistrar = New CommandRegistrar(serviceProvider)
		cmdRegistrar.Register()
		Dim nodeRegistrar As NodeMapRegistrar = New NodeMapRegistrar(serviceProvider)
		nodeRegistrar.Register()
	End Sub

	''' <summary>
	''' Initializes the $Caption$.
	''' </summary>
	''' <param name="serviceProvider">The a mechanism for retrieving a service object that is, an object that provides custom support to other objects.</param>
	''' <param name="rootNode">The root node of the application.</param>
    ''' <param name="section">The <see cref="ConfigurationSection"/> that was opened from the <see cref="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationSource"/>.</param>
	Protected Overrides Sub OpenCore(ByVal serviceProvider As IServiceProvider, ByVal rootNode As ConfigurationApplicationNode, ByVal section As System.Configuration.ConfigurationSection)
		MyBase.OpenCore(serviceProvider, rootNode, section)
		' TODO: This code is useful every time you add a new node to the $Name$ Design-Time. If the new node constains references to other existent nodes, <see cref="IConfigurationUIHierarchy"> is useful to find and them. Then you should verify if it is the node that you are searching for and assign it to the new node. 
		'Dim hierarchy As IConfigurationUIHierarchy = ServiceHelper.GetCurrentHierarchy(serviceProvider)
		'For Each node As $Name$Node In hierarchy.FindNodesByType(GetType($Name$Node))
		'    For Each referentNode As ReferentNodeType in hierarchy.FindNodesByType(GetType(ReferentNodeType))
		'        If referentNode.Name == node.referentNodeName Then
		'            node.ReferentNode = referentNode
		'            Break
		'		End If
		'	 Next
		'Next        
	End Sub
End Class


